<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>slot-具名插槽</title>
    <script src="../lib/vue_v2.6.14.js"></script>
  </head>
  <body>
    <div id="app">
      <cpn-son>
        <button slot="left">返回</button>
        <input type="text" placeholder="请输入" slot="center" />
      </cpn-son>
    </div>

    <template id="cpn">
      <div style="margin-bottom: 50px">
        <slot name="left"><span>左边</span></slot>
        <slot name="center"><span>中间</span></slot>
        <slot><span>右边</span></slot>
      </div>
    </template>
    <script>
      // 子组件
      Vue.component('cpn-son', {
        template: '#cpn'
      })

      // 父组件
      const vm = new Vue({
        el: '#app',
        data: {}
      })
    </script>
  </body>
</html>
